<?php
  require_once 'DB.php';
  include_once("./libraries/db.inc.php");
  include_once("./libraries/authentication.inc.php");
  include_once("./queries/jobHistory.inc.php");
  include_once("./libraries/util.inc.php");
  include_once("./libraries/displayUtils.inc.php");
  

  session_start();
  sessionAuthenticate("login.php");

  $cid = $_GET["cid"];  
  $pid = $_GET["pid"];
  $schedd = $_GET["schedd"];

  setUpDisplay("Job History Info");

  $connection=DB::connect($dsn, $options);
  if (DB::isError($connection)) {
    trigger_error($connection->getMessage(), E_USER_ERROR);
  }
  
  


  echo "<font size=5><center><b>Historical Proc Info</b></center></font><br />\n";
  echo "<font size=5><center><b>for job: '{$schedd}'.{$cid}.{$pid}.</b></center></font><br />\n";
  printLink("./index.php", "Take me back to the main page!");
  echo "\n";

  echo "<br /><br /><b>Here is classad info:</b><br />\n";
  $dataIndex="procHistoryShort";
  $rs = single_proc_short_history_query($connection, $dataIndex, $schedd, $cid, $pid);
	//$rs->setLinkParams(0, array("mid"), array(0), "machineInfo.php");
  $rs->printTable();
  printLink("./procHistoryInfoLong.php?cid={$cid}&pid={$pid}&schedd={$schedd}", 
             "See the complete class ad"); 

  echo "<br /><br /><b>Here is info about runs of the proc:</b><br />\n";
  $dataIndex="procHistoryInfoRuns";
  $rs = single_proc_runs_history_query($connection, $dataIndex, $schedd, $cid, $pid);
	//$rs->setLinkParams(1, array("mid"), array(1), "machineInfo.php");
  $rs->printTable();

  // events related
  echo "<br /><br /><b>Here is info about events of the proc:</b><br />\n";
  $dataIndex="procHistoryInfoEvents";
  $rs = single_proc_events_history_query($connection, $dataIndex, $schedd, $cid, $pid);
	//$rs->setLinkParams(1, array("mid"), array(1), "machineInfo.php");
  $rs->printTable();


  //echo "<br /><br /><b>Here is rolled-up info about matches:</b><br />\n";
  //$dataIndex="procHistoryInfoMatchesRollup";
  //single_proc_matches_history_summary($connection, $dataIndex, $schedd, $cid, $pid);
  //$rs=new recordset();
  //$rs->__construct($_SESSION["{$dataIndex}"]["time"],
  //                 $_SESSION["{$dataIndex}"]["fields"],
  //                 $_SESSION["{$dataIndex}"]["recSet"]);
  //$rs->setLinkParams(0, array("schedd", "cid", "pid", "matchTime"),
  //                      array(1,2,3,0), "matchHistoryList.php");
  //$rs->setLinkParams(1, array("mid"), array(1), "machineInfo.php");
  //$rs->setLinkParams(4, array("mid"), array(4), "machineInfo.php");
  //$rs->complexSetLinkParams(0, array("schedd", "cid", "pid", "matchTime"), 
  //                             array(1,2,3,0));
  //$rs->linkFile="matchHistoryList.php";
  //$rs->printTable(1, count($_SESSION["{$dataIndex}"]["recSet"]));

  cdbFinishPage();
  $connection->disconnect();

?>
